package com.Extends.One;

//猫和狗
public class AnimalDemo {
    public static void main(String[] args) {
        //构造猫类对象并进行测试
        Cat c1 = new Cat();
        c1.setName("小白");
        c1.setAge(4);
        System.out.println(c1.getName()+","+c1.getAge());
        c1.catchMouse();

        Cat c2 = new Cat("小黑",5);
        System.out.println(c2.getName()+","+c2.getAge());
        c2.catchMouse();

        //构造狗类对象并进行测试
        Dog d1 = new Dog();
        d1.setName("老白");
        d1.setAge(7);
        System.out.println(d1.getName()+","+d1.getAge());
        d1.guardHouse();

        Dog d2 = new Dog("老黑",8);
        System.out.println(d2.getName()+","+d2.getAge());
        d2.guardHouse();
    }
}
